<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkDialog</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="WindowWidgets.html" title="窗口">
<link rel="prev" href="WindowWidgets.html" title="窗口">
<link rel="next" href="gtk3-GtkInvisible.html" title="GtkInvisible">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="WindowWidgets.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="WindowWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="gtk3-GtkInvisible.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-GtkDialog.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-GtkDialog.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-GtkDialog"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkDialog.top_of_page"></a>GtkDialog</span></h2>
<p>GtkDialog — Create popup windows</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-GtkDialog.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog">GtkDialog</a>;
enum                <a class="link" href="gtk3-GtkDialog.html#GtkDialogFlags" title="enum GtkDialogFlags">GtkDialogFlags</a>;
enum                <a class="link" href="gtk3-GtkDialog.html#GtkResponseType" title="enum GtkResponseType">GtkResponseType</a>;
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new" title="gtk_dialog_new ()">gtk_dialog_new</a>                      (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()">gtk_dialog_new_with_buttons</a>         (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *title</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialogFlags" title="enum GtkDialogFlags"><span class="type">GtkDialogFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_button_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()">gtk_dialog_run</a>                      (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-response" title="gtk_dialog_response ()">gtk_dialog_response</a>                 (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-button" title="gtk_dialog_add_button ()">gtk_dialog_add_button</a>               (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *button_text</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-buttons" title="gtk_dialog_add_buttons ()">gtk_dialog_add_buttons</a>              (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_button_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-action-widget" title="gtk_dialog_add_action_widget ()">gtk_dialog_add_action_widget</a>        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *child</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-default-response" title="gtk_dialog_set_default_response ()">gtk_dialog_set_default_response</a>     (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-response-sensitive" title="gtk_dialog_set_response_sensitive ()">gtk_dialog_set_response_sensitive</a>   (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> setting</code></em>);
<a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-response-for-widget" title="gtk_dialog_get_response_for_widget ()">gtk_dialog_get_response_for_widget</a>  (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-widget-for-response" title="gtk_dialog_get_widget_for_response ()">gtk_dialog_get_widget_for_response</a>  (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-action-area" title="gtk_dialog_get_action_area ()">gtk_dialog_get_action_area</a>          (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-content-area" title="gtk_dialog_get_content_area ()">gtk_dialog_get_content_area</a>         (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);

<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-GtkDialog.html#gtk-alternative-dialog-button-order" title="gtk_alternative_dialog_button_order ()">gtk_alternative_dialog_button_order</a> (<em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-alternative-button-order" title="gtk_dialog_set_alternative_button_order ()">gtk_dialog_set_alternative_button_order</a>
                                                        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> first_response_id</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-alternative-button-order-from-array" title="gtk_dialog_set_alternative_button_order_from_array ()">gtk_dialog_set_alternative_button_order_from_array</a>
                                                        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_params</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *new_order</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkDialog.description"></a><h2>Description</h2>
<p>
Dialog boxes are a convenient way to prompt the user for a small amount
of input, e.g. to display a message, ask a question, or anything else
that does not require extensive effort on the user's part.
</p>
<p>
GTK+ treats a dialog as a window split vertically. The top section is a
<a class="link" href="gtk3-GtkVBox.html#GtkVBox" title="struct GtkVBox"><span class="type">GtkVBox</span></a>, and is where widgets such as a <a class="link" href="gtk3-GtkLabel.html#GtkLabel" title="struct GtkLabel"><span class="type">GtkLabel</span></a> or a <a class="link" href="gtk3-GtkEntry.html#GtkEntry" title="struct GtkEntry"><span class="type">GtkEntry</span></a> should
be packed. The bottom area is known as the
<em class="structfield"><code>action_area</code></em>. This is generally used for
packing buttons into the dialog which may perform functions such as
cancel, ok, or apply.
</p>
<p>
<a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> boxes are created with a call to <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new" title="gtk_dialog_new ()"><code class="function">gtk_dialog_new()</code></a> or
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()"><code class="function">gtk_dialog_new_with_buttons()</code></a>. <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()"><code class="function">gtk_dialog_new_with_buttons()</code></a> is
recommended; it allows you to set the dialog title, some convenient flags,
and add simple buttons.
</p>
<p>
If 'dialog' is a newly created dialog, the two primary areas of the
window can be accessed through <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-content-area" title="gtk_dialog_get_content_area ()"><code class="function">gtk_dialog_get_content_area()</code></a> and
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-get-action-area" title="gtk_dialog_get_action_area ()"><code class="function">gtk_dialog_get_action_area()</code></a>, as can be seen from the example below.
</p>
<p>
A 'modal' dialog (that is, one which freezes the rest of the application
from user input), can be created by calling <a class="link" href="gtk3-GtkWindow.html#gtk-window-set-modal" title="gtk_window_set_modal ()"><code class="function">gtk_window_set_modal()</code></a> on the
dialog. Use the <code class="function">GTK_WINDOW()</code> macro to cast the widget returned from
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new" title="gtk_dialog_new ()"><code class="function">gtk_dialog_new()</code></a> into a <a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a>. When using <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()"><code class="function">gtk_dialog_new_with_buttons()</code></a>
you can also pass the <a class="link" href="gtk3-GtkDialog.html#GTK-DIALOG-MODAL:CAPS"><span class="type">GTK_DIALOG_MODAL</span></a> flag to make a dialog modal.
</p>
<p>
If you add buttons to <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> using <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()"><code class="function">gtk_dialog_new_with_buttons()</code></a>,
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-button" title="gtk_dialog_add_button ()"><code class="function">gtk_dialog_add_button()</code></a>, <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-buttons" title="gtk_dialog_add_buttons ()"><code class="function">gtk_dialog_add_buttons()</code></a>, or
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-action-widget" title="gtk_dialog_add_action_widget ()"><code class="function">gtk_dialog_add_action_widget()</code></a>, clicking the button will emit a signal
called <span class="type">"response"</span> with a response ID that you specified. GTK+
will never assign a meaning to positive response IDs; these are entirely
user-defined. But for convenience, you can use the response IDs in the
<a class="link" href="gtk3-GtkDialog.html#GtkResponseType" title="enum GtkResponseType"><span class="type">GtkResponseType</span></a> enumeration (these all have values less than zero). If
a dialog receives a delete event, the <span class="type">"response"</span> signal will
be emitted with a response ID of <a class="link" href="gtk3-GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>.
</p>
<p>
If you want to block waiting for a dialog to return before returning
control flow to your code, you can call <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a>. This function
enters a recursive main loop and waits for the user to respond to the
dialog, returning the response ID corresponding to the button the user
clicked.
</p>
<p>
For the simple dialog in the following example, in reality you'd probably
use <a class="link" href="gtk3-GtkMessageDialog.html#GtkMessageDialog" title="struct GtkMessageDialog"><span class="type">GtkMessageDialog</span></a> to save yourself some effort. But you'd need to
create the dialog contents manually if you had more than a simple message
in the dialog.
</p>
<div class="example">
<a name="id3267538"></a><p class="title"><b>Example 43. Simple GtkDialog usage</b></p>
<div class="example-contents"><pre class="programlisting">
/* Function to open a dialog box displaying the message provided. */
void
quick_message (gchar *message)
{
   GtkWidget *dialog, *label, *content_area;

   /* Create the widgets */
   dialog = gtk_dialog_new_with_buttons ("Message",
                                         main_application_window,
                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                         GTK_STOCK_OK,
                                         GTK_RESPONSE_NONE,
                                         NULL);
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
   label = gtk_label_new (message);

   /* Ensure that the dialog box is destroyed when the user responds */
   g_signal_connect_swapped (dialog,
                             "response",
                             G_CALLBACK (gtk_widget_destroy),
                             dialog);

   /* Add the label, and show everything we've added to the dialog */

   gtk_container_add (GTK_CONTAINER (content_area), label);
   gtk_widget_show_all (dialog);
}
</pre></div>
</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="refsect2">
<a name="GtkDialog-BUILDER-UI"></a><h3>GtkDialog as GtkBuildable</h3>
<p>
The GtkDialog implementation of the <a class="link" href="gtk3-GtkBuildable.html#GtkBuildable" title="GtkBuildable"><span class="type">GtkBuildable</span></a> interface exposes the
<em class="parameter"><code>vbox</code></em> and <em class="parameter"><code>action_area</code></em> as internal children with the names "vbox" and
"action_area".
</p>
<p>
GtkDialog supports a custom &lt;action-widgets&gt; element, which
can contain multiple &lt;action-widget&gt; elements. The "response"
attribute specifies a numeric response, and the content of the element
is the id of widget (which should be a child of the dialogs <em class="parameter"><code>action_area</code></em>).
</p>
<div class="example">
<a name="id3267620"></a><p class="title"><b>Example 44. A <span class="structname">GtkDialog</span> UI definition fragment.</b></p>
<div class="example-contents"><pre class="programlisting">
&lt;object class="GtkDialog" id="dialog1"&gt;
  &lt;child internal-child="vbox"&gt;"
    &lt;object class="GtkVBox" id="vbox"&gt;
      &lt;child internal-child="action_area"&gt;
        &lt;object class="GtkHButtonBox" id="button_box"&gt;
          &lt;child&gt;
            &lt;object class="GtkButton" id="button_cancel"/&gt;
          &lt;/child&gt;
          &lt;child&gt;
            &lt;object class="GtkButton" id="button_ok"/&gt;
          &lt;/child&gt;
        &lt;/object&gt;
      &lt;/child&gt;
    &lt;/object&gt;
  &lt;/child&gt;
  &lt;action-widgets&gt;
    &lt;action-widget response="3"&gt;button_ok&lt;/action-widget&gt;
    &lt;action-widget response="-5"&gt;button_cancel&lt;/action-widget&gt;
  &lt;/action-widgets&gt;
&lt;/object&gt;
</pre></div>
</div>
<br class="example-break">
</div>
<p>
</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkDialog.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkDialog"></a><h3>struct GtkDialog</h3>
<pre class="programlisting">struct GtkDialog {
  GtkWindow window;
};
</pre>
<p>
The GtkDialog struct contains only private fields
and should not be directly accessed.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GtkDialogFlags"></a><h3>enum GtkDialogFlags</h3>
<pre class="programlisting">typedef enum {
  GTK_DIALOG_MODAL               = 1 &lt;&lt; 0,
  GTK_DIALOG_DESTROY_WITH_PARENT = 1 &lt;&lt; 1
} GtkDialogFlags;
</pre>
<p>
Flags used to influence dialog construction.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GTK-DIALOG-MODAL:CAPS"></a><span class="term"><code class="literal">GTK_DIALOG_MODAL</code></span></p></td>
<td>Make the constructed dialog modal,
    see <a class="link" href="gtk3-GtkWindow.html#gtk-window-set-modal" title="gtk_window_set_modal ()"><code class="function">gtk_window_set_modal()</code></a>
</td>
</tr>
<tr>
<td><p><a name="GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"></a><span class="term"><code class="literal">GTK_DIALOG_DESTROY_WITH_PARENT</code></span></p></td>
<td>Destroy the dialog when its
    parent is destroyed, see <a class="link" href="gtk3-GtkWindow.html#gtk-window-set-destroy-with-parent" title="gtk_window_set_destroy_with_parent ()"><code class="function">gtk_window_set_destroy_with_parent()</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GtkResponseType"></a><h3>enum GtkResponseType</h3>
<pre class="programlisting">typedef enum {
  GTK_RESPONSE_NONE         = -1,
  GTK_RESPONSE_REJECT       = -2,
  GTK_RESPONSE_ACCEPT       = -3,
  GTK_RESPONSE_DELETE_EVENT = -4,
  GTK_RESPONSE_OK           = -5,
  GTK_RESPONSE_CANCEL       = -6,
  GTK_RESPONSE_CLOSE        = -7,
  GTK_RESPONSE_YES          = -8,
  GTK_RESPONSE_NO           = -9,
  GTK_RESPONSE_APPLY        = -10,
  GTK_RESPONSE_HELP         = -11
} GtkResponseType;
</pre>
<p>
Predefined values for use as response ids in <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-button" title="gtk_dialog_add_button ()"><code class="function">gtk_dialog_add_button()</code></a>.
All predefined values are negative, GTK+ leaves positive values for
application-defined response ids.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GTK-RESPONSE-NONE:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_NONE</code></span></p></td>
<td>Returned if an action widget has no response id,
    or if the dialog gets programmatically hidden or destroyed
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-REJECT:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_REJECT</code></span></p></td>
<td>Generic response id, not used by GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-ACCEPT:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_ACCEPT</code></span></p></td>
<td>Generic response id, not used by GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-DELETE-EVENT:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_DELETE_EVENT</code></span></p></td>
<td>Returned if the dialog is deleted
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-OK:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_OK</code></span></p></td>
<td>Returned by OK buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-CANCEL:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_CANCEL</code></span></p></td>
<td>Returned by Cancel buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-CLOSE:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_CLOSE</code></span></p></td>
<td>Returned by Close buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-YES:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_YES</code></span></p></td>
<td>Returned by Yes buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-NO:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_NO</code></span></p></td>
<td>Returned by No buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-APPLY:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_APPLY</code></span></p></td>
<td>Returned by Apply buttons in GTK+ dialogs
</td>
</tr>
<tr>
<td><p><a name="GTK-RESPONSE-HELP:CAPS"></a><span class="term"><code class="literal">GTK_RESPONSE_HELP</code></span></p></td>
<td>Returned by Help buttons in GTK+ dialogs
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-new"></a><h3>gtk_dialog_new ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_new                      (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new dialog box.
</p>
<p>
Widgets should not be packed into this <a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a>
directly, but into the <em class="parameter"><code>vbox</code></em> and <em class="parameter"><code>action_area</code></em>, as described above.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new dialog as a <a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-new-with-buttons"></a><h3>gtk_dialog_new_with_buttons ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_new_with_buttons         (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *title</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a> *parent</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialogFlags" title="enum GtkDialogFlags"><span class="type">GtkDialogFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_button_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> with title <em class="parameter"><code>title</code></em> (or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the default
title; see <a class="link" href="gtk3-GtkWindow.html#gtk-window-set-title" title="gtk_window_set_title ()"><code class="function">gtk_window_set_title()</code></a>) and transient parent <em class="parameter"><code>parent</code></em> (or
<a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for none; see <a class="link" href="gtk3-GtkWindow.html#gtk-window-set-transient-for" title="gtk_window_set_transient_for ()"><code class="function">gtk_window_set_transient_for()</code></a>). The <em class="parameter"><code>flags</code></em>
argument can be used to make the dialog modal (<a class="link" href="gtk3-GtkDialog.html#GTK-DIALOG-MODAL:CAPS"><span class="type">GTK_DIALOG_MODAL</span></a>)
and/or to have it destroyed along with its transient parent
(<a class="link" href="gtk3-GtkDialog.html#GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"><span class="type">GTK_DIALOG_DESTROY_WITH_PARENT</span></a>). After <em class="parameter"><code>flags</code></em>, button
text/response ID pairs should be listed, with a <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> pointer ending
the list. Button text can be either a stock ID such as
<a class="link" href="gtk3-Stock-Items.html#GTK-STOCK-OK:CAPS" title="GTK_STOCK_OK"><span class="type">GTK_STOCK_OK</span></a>, or some arbitrary text. A response ID can be
any positive number, or one of the values in the <a class="link" href="gtk3-GtkDialog.html#GtkResponseType" title="enum GtkResponseType"><span class="type">GtkResponseType</span></a>
enumeration. If the user clicks one of these dialog buttons,
<a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> will emit the <span class="type">"response"</span> signal with the corresponding
response ID. If a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> receives the <span class="type">"delete-event"</span> signal,
it will emit ::response with a response ID of <a class="link" href="gtk3-GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>.
However, destroying a dialog does not emit the ::response signal;
so be careful relying on ::response when using the
<a class="link" href="gtk3-GtkDialog.html#GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"><span class="type">GTK_DIALOG_DESTROY_WITH_PARENT</span></a> flag. Buttons are from left to right,
so the first button in the list will be the leftmost button in the dialog.
</p>
<p>
Here's a simple example:
</p>
<div class="informalexample"><pre class="programlisting">
 GtkWidget *dialog = gtk_dialog_new_with_buttons ("My dialog",
                                                  main_app_window,
                                                  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                  GTK_STOCK_OK,
                                                  GTK_RESPONSE_ACCEPT,
                                                  GTK_STOCK_CANCEL,
                                                  GTK_RESPONSE_REJECT,
                                                  NULL);
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>title</code></em> :</span></p></td>
<td>Title of the dialog, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parent</code></em> :</span></p></td>
<td>Transient parent of the dialog, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>from <a class="link" href="gtk3-GtkDialog.html#GtkDialogFlags" title="enum GtkDialogFlags"><span class="type">GtkDialogFlags</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></p></td>
<td>stock ID or text to go in first button, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-run"></a><h3>gtk_dialog_run ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gtk_dialog_run                      (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);</pre>
<p>
Blocks in a recursive main loop until the <em class="parameter"><code>dialog</code></em> either emits the
<span class="type">"response"</span> signal, or is destroyed. If the dialog is
destroyed during the call to <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a>, <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> returns
<a class="link" href="gtk3-GtkDialog.html#GTK-RESPONSE-NONE:CAPS"><span class="type">GTK_RESPONSE_NONE</span></a>. Otherwise, it returns the response ID from the
::response signal emission.
</p>
<p>
Before entering the recursive main loop, <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> calls
<a class="link" href="gtk3-GtkWidget.html#gtk-widget-show" title="gtk_widget_show ()"><code class="function">gtk_widget_show()</code></a> on the dialog for you. Note that you still
need to show any children of the dialog yourself.
</p>
<p>
During <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a>, the default behavior of <span class="type">"delete-event"</span>
is disabled; if the dialog receives ::delete_event, it will not be
destroyed as windows usually are, and <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> will return
<a class="link" href="gtk3-GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>. Also, during <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> the dialog
will be modal. You can force <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> to return at any time by
calling <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-response" title="gtk_dialog_response ()"><code class="function">gtk_dialog_response()</code></a> to emit the ::response signal. Destroying
the dialog during <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> is a very bad idea, because your
post-run code won't know whether the dialog was destroyed or not.
</p>
<p>
After <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> returns, you are responsible for hiding or
destroying the dialog if you wish to do so.
</p>
<p>
Typical usage of this function might be:
</p>
<div class="informalexample"><pre class="programlisting">
  gint result = gtk_dialog_run (GTK_DIALOG (dialog));
  switch (result)
    {
      case GTK_RESPONSE_ACCEPT:
         do_application_specific_something ();
         break;
      default:
         do_nothing_since_dialog_was_cancelled ();
         break;
    }
  gtk_widget_destroy (dialog);
</pre></div>
<p>
</p>
<p>
Note that even though the recursive main loop gives the effect of a
modal dialog (it prevents the user from interacting with other
windows in the same window group while the dialog is run), callbacks
such as timeouts, IO channel watches, DND drops, etc, <span class="emphasis"><em>will</em></span>
be triggered during a <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> call.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>response ID</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-response"></a><h3>gtk_dialog_response ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_response                 (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);</pre>
<p>
Emits the <span class="type">"response"</span> signal with the given response ID.
Used to indicate that the user has responded to the dialog in some way;
typically either you or <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-run" title="gtk_dialog_run ()"><code class="function">gtk_dialog_run()</code></a> will be monitoring the
::response signal and take appropriate action.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>response ID</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-add-button"></a><h3>gtk_dialog_add_button ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_add_button               (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *button_text</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);</pre>
<p>
Adds a button with the given text (or a stock button, if <em class="parameter"><code>button_text</code></em> is a
stock ID) and sets things up so that clicking the button will emit the
<span class="type">"response"</span> signal with the given <em class="parameter"><code>response_id</code></em>. The button is
appended to the end of the dialog's action area. The button widget is
returned, but usually you don't need it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>button_text</code></em> :</span></p></td>
<td>text of button, or stock ID</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>response ID for the button</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the <a class="link" href="gtk3-GtkButton.html#GtkButton" title="struct GtkButton"><span class="type">GtkButton</span></a> widget that was added. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-add-buttons"></a><h3>gtk_dialog_add_buttons ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_add_buttons              (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *first_button_text</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Adds more buttons, same as calling <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-add-button" title="gtk_dialog_add_button ()"><code class="function">gtk_dialog_add_button()</code></a>
repeatedly.  The variable argument list should be <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated
as with <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-new-with-buttons" title="gtk_dialog_new_with_buttons ()"><code class="function">gtk_dialog_new_with_buttons()</code></a>. Each button must have both
text and response ID.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></p></td>
<td>button text or stock ID</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-add-action-widget"></a><h3>gtk_dialog_add_action_widget ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_add_action_widget        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *child</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);</pre>
<p>
Adds an activatable widget to the action area of a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>,
connecting a signal handler that will emit the <span class="type">"response"</span>
signal on the dialog when the widget is activated. The widget is
appended to the end of the dialog's action area. If you want to add a
non-activatable widget, simply pack it into the <em class="parameter"><code>action_area</code></em> field
of the <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> struct.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td>
<td>an activatable widget</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>response ID for <em class="parameter"><code>child</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-set-default-response"></a><h3>gtk_dialog_set_default_response ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_set_default_response     (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);</pre>
<p>
Sets the last widget in the dialog's action area with the given <em class="parameter"><code>response_id</code></em>
as the default widget for the dialog. Pressing "Enter" normally activates
the default widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>a response ID</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-set-response-sensitive"></a><h3>gtk_dialog_set_response_sensitive ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_set_response_sensitive   (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> setting</code></em>);</pre>
<p>
Calls <code class="literal">gtk_widget_set_sensitive (widget, <em class="parameter"><code>setting</code></em>)</code>
for each widget in the dialog's action area with the given <em class="parameter"><code>response_id</code></em>.
A convenient way to sensitize/desensitize dialog buttons.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>a response ID</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>setting</code></em> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for sensitive</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-get-response-for-widget"></a><h3>gtk_dialog_get_response_for_widget ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gtk_dialog_get_response_for_widget  (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="type">GtkWidget</span></a> *widget</code></em>);</pre>
<p>
Gets the response id of a widget in the action area
of a dialog.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>widget</code></em> :</span></p></td>
<td>a widget in the action area of <em class="parameter"><code>dialog</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the response id of <em class="parameter"><code>widget</code></em>, or <a class="link" href="gtk3-GtkDialog.html#GTK-RESPONSE-NONE:CAPS"><code class="literal">GTK_RESPONSE_NONE</code></a>
if <em class="parameter"><code>widget</code></em> doesn't have a response id set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-get-widget-for-response"></a><h3>gtk_dialog_get_widget_for_response ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_get_widget_for_response  (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> response_id</code></em>);</pre>
<p>
Gets the widget button that uses the given response ID in the action area
of a dialog.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>response_id</code></em> :</span></p></td>
<td>the response ID used by the <em class="parameter"><code>dialog</code></em> widget</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the <em class="parameter"><code>widget</code></em> button that uses the given
<em class="parameter"><code>response_id</code></em>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-get-action-area"></a><h3>gtk_dialog_get_action_area ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_get_action_area          (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);</pre>
<p>
Returns the action area of <em class="parameter"><code>dialog</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the action area. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-get-content-area"></a><h3>gtk_dialog_get_content_area ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_dialog_get_content_area         (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>);</pre>
<p>
Returns the content area of <em class="parameter"><code>dialog</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the content area <a class="link" href="gtk3-GtkBox.html#GtkBox" title="struct GtkBox"><span class="type">GtkBox</span></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-alternative-dialog-button-order"></a><h3>gtk_alternative_dialog_button_order ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_alternative_dialog_button_order (<em class="parameter"><code><a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
<p>
Returns <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if dialogs are expected to use an alternative
button order on the screen <em class="parameter"><code>screen</code></em>. See
<a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-alternative-button-order" title="gtk_dialog_set_alternative_button_order ()"><code class="function">gtk_dialog_set_alternative_button_order()</code></a> for more details
about alternative button order.
</p>
<p>
If you need to use this function, you should probably connect
to the ::notify:gtk-alternative-button-order signal on the
<a class="link" href="gtk3-GtkSettings.html#GtkSettings" title="GtkSettings"><span class="type">GtkSettings</span></a> object associated to <em class="parameter"><code>screen</code></em>, in order to be
notified if the button order setting changes.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>screen</code></em> :</span></p></td>
<td>a <a href="../gdk3/GdkScreen.html"><span class="type">GdkScreen</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to use the default screen. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>Whether the alternative button order should be used</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-set-alternative-button-order"></a><h3>gtk_dialog_set_alternative_button_order ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_set_alternative_button_order
                                                        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> first_response_id</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Sets an alternative button order. If the
<span class="type">"gtk-alternative-button-order"</span> setting is set to <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>,
the dialog buttons are reordered according to the order of the
response ids passed to this function.
</p>
<p>
By default, GTK+ dialogs use the button order advocated by the Gnome
<a class="ulink" href="http://library.gnome.org/devel/hig-book/stable/" target="_top">Human
Interface Guidelines</a> with the affirmative button at the far
right, and the cancel button left of it. But the builtin GTK+ dialogs
and <a class="link" href="gtk3-GtkMessageDialog.html#GtkMessageDialog" title="struct GtkMessageDialog"><span class="type">GtkMessageDialog</span></a>s do provide an alternative button order,
which is more suitable on some platforms, e.g. Windows.
</p>
<p>
Use this function after adding all the buttons to your dialog, as the
following example shows:
</p>
<div class="informalexample"><pre class="programlisting">
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                       GTK_STOCK_CANCEL,
                                       GTK_RESPONSE_CANCEL);

ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                   GTK_STOCK_OK,
                                   GTK_RESPONSE_OK);

gtk_widget_grab_default (ok_button);

help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
                                     GTK_STOCK_HELP,
                                     GTK_RESPONSE_HELP);

gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                         GTK_RESPONSE_OK,
                                         GTK_RESPONSE_CANCEL,
                                         GTK_RESPONSE_HELP,
                                         -1);
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_response_id</code></em> :</span></p></td>
<td>a response id used by one <em class="parameter"><code>dialog</code></em>'s buttons</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-dialog-set-alternative-button-order-from-array"></a><h3>gtk_dialog_set_alternative_button_order_from_array ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_dialog_set_alternative_button_order_from_array
                                                        (<em class="parameter"><code><a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a> *dialog</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_params</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *new_order</code></em>);</pre>
<p>
Sets an alternative button order. If the
<span class="type">"gtk-alternative-button-order"</span> setting is set to <a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>,
the dialog buttons are reordered according to the order of the
response ids in <em class="parameter"><code>new_order</code></em>.
</p>
<p>
See <a class="link" href="gtk3-GtkDialog.html#gtk-dialog-set-alternative-button-order" title="gtk_dialog_set_alternative_button_order ()"><code class="function">gtk_dialog_set_alternative_button_order()</code></a> for more information.
</p>
<p>
This function is for use by language bindings.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>dialog</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkDialog.html#GtkDialog" title="struct GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_params</code></em> :</span></p></td>
<td>the number of response ids in <em class="parameter"><code>new_order</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>new_order</code></em> :</span></p></td>
<td>an array of response ids of
<em class="parameter"><code>dialog</code></em>'s buttons. <span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=n_params]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.6</p>
</div>
</div>
<div class="refsect1">
<a name="gtk3-GtkDialog.see-also"></a><h2>See Also</h2>
<a class="link" href="gtk3-GtkVBox.html#GtkVBox" title="struct GtkVBox"><span class="type">GtkVBox</span></a>, <a class="link" href="gtk3-GtkWindow.html#GtkWindow" title="GtkWindow"><span class="type">GtkWindow</span></a>, <a class="link" href="gtk3-GtkButton.html#GtkButton" title="struct GtkButton"><span class="type">GtkButton</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>